//
//  LLDismissAnimation.swift
//  WeiBoShiBing
//
//  Created by Bingo on 15/11/10.
//  Copyright © 2015年 Bingo. All rights reserved.
//

import UIKit

class LLDismissAnimation:NSObject,UIViewControllerAnimatedTransitioning{

    func transitionDuration(transitionContext: UIViewControllerContextTransitioning?) -> NSTimeInterval{
        
        return 0.25
    }
    
    func animateTransition(transitionContext: UIViewControllerContextTransitioning){
    
        let fromView = transitionContext.viewForKey(UITransitionContextFromViewKey)
        
        print("fromView:\(fromView?.frame)")
        
        UIView.animateWithDuration(transitionDuration(nil), animations: { () -> Void in
                fromView?.transform = CGAffineTransformMakeScale(1, 0.01)
            }) { (_) -> Void in
                transitionContext.completeTransition(true)
        }
    }

}